<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions"
	xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
	xmlns:camunda="http://camunda.org/schema/1.0/bpmn" 
	targetNamespace="Examples">
	
	<process id="CatchErrorThrownByScriptTaskInEmbeddedSubProcess" isExecutable="true">

		<startEvent id="theStart" />
		<sequenceFlow id="flow1" sourceRef="theStart" targetRef="subprocess" />

    <subProcess id="subprocess">
      <startEvent id="subprocessStart" />
      <sequenceFlow id="subFlow1" sourceRef="subprocessStart" targetRef="subprocessScriptTask" />
      <scriptTask id="subprocessScriptTask" scriptFormat="groovy">
        <script>
          throw new org.camunda.bpm.engine.delegate.BpmnError("123");
        </script>
      </scriptTask>
      
      <subProcess id="eventSubProcess" triggeredByEvent="true">
		    <startEvent id="catchError">
		      <errorEventDefinition /> <!-- no errorCode: catch any error -->
		    </startEvent>
		    <sequenceFlow id="flow2" sourceRef="catchError" targetRef="taskAfterErrorCatch" />
		    <userTask id="taskAfterErrorCatch" name="Escalated Task" />
      </subProcess>

    </subProcess>
    <sequenceFlow id="flow3" sourceRef="subprocess" targetRef="theEnd" />
		
		<endEvent id="theEnd" />

	</process>

</definitions>
